1. Field of the Invention
The present invention relates to a signal processing apparatus that allows a stream that has been recorded as a variable length code on a record medium not to be output when the stream contains a syntax error or a format violation.
2. Description of the Related Art
As represented by a digital VCR (Video Cassette Recorder), a data recording and reproducing apparatus that records a digital video signal and a digital audio signal to a record medium and that reproduces them therefrom is known. Since the data capacity of a digital video signal is huge, it is normally compressed and encoded before it is recorded on the record medium. In recent years, the MPEG2 (Moving Picture Experts Group 2) system is known as a standard compressing and encoding system.
In picture compression technologies including the foregoing MPEG2 system, the data compression rate is improved using a variable length code. Thus, depending on the complexity of a picture to be compressed, the code amount of one screen (for example, one frame or one field) that has been compressed varies.
The forgoing MPEG2 system has a hierarchical structure composed of a macro block layer, a slice layer, a picture layer, a GOP layer, and a sequence layer disposed in the order from the bottom to the top. In the hierarchical structure, the slice layer is a unit of a variable length code encoding process. The macro block layer is composed of a plurality of DCT (Discrete Cosine Transform) blocks. At the beginning of each layer, a header portion that stores header information is disposed. For example, in the slice layer, by detecting the header portion, the delimitation position of a variable length code is detected. A decoder decodes a variable length code corresponding to the detected delimitation positions thereof.
In the MPEG2 system, a data array prescribed thereby is referred to as syntax.
On the other hand, there are many video data formats in combination of a picture size, a frame frequency, a scanning method, and so forth. Generally, video apparatuses used in a broadcasting station and those used by professional users can deal with limited video data formats. The forgoing MPEG2 standard is designed to flexibly deal with various video formats.
In recent years, a recording apparatus that inputs a video signal as a non-compressed base band signal and compresses and encodes the video signal with a variable length code corresponding to MPEG2 system or JPEG (Joint Photographic Experts Group) system is known.
Next, the case that a stream that contains an syntax error or a format violation is output to such an apparatus will be considered. The output stream is supplied to another video signal processing apparatus or the like. For example, the stream is input to a decoder. The decoder decodes a variable length code. When an invalid data stream (namely, a data stream that contains a syntax error) is input to a decoder of a system that uses a variable length code (for example, an MPEG2 decoder), the decoder cannot decode the data stream that has been input.
As a first reason, a variable length code cannot be decoded. Unless a code that has a solution (decoded result) against all codes (a combination of “1s” and “0s” or a fixed length code is used, there is a possibility of which a code sequence cannot be decoded. For example, in the case of the MPEG2 system, as was described above, although a slice is one code sequence, after the position at which an invalid stream is placed in the slice, the remaining slice may not be decoded.
As a second reason, even if a variable length code sequence can be decoded, the decoded data becomes invalid or contradictory. For example, when an error enters a system that uses a code that has a solution against all codes, although some data is decoded, the content of the decoded data becomes meaningless.
As with the MPEG2 system, even if a code that has a solution against all codes is not used, when an invalid variable length code sequence may accidentally match another code that has a different meaning therefrom, the code sequence may be decoded. In this case, there is a high possibility of which decoded data contains inconsistency or invalidity.
For example, in the MPEG2 system, a DCT block may contain 65 elements instead of 64 elements; the number of DCT blocks in a macro block does not match a predetermined value; the number of macro blocks in a slice does not match a predetermined value; control may be jumped to a prohibited macro block address; control may be jumped in the reverse direction; or control may be jumped to an address that is out of the range of the system.
In a video system, a syntax error tends to disorder a decoded picture. Generally, in a system using a variable length code, a syntax error may cause the decoder to hang up.
Such a syntax error does not takes place in a special situation. Instead, in a reproducing apparatus, when a signal path is switched from a reproduction monitor system to an EE system (Electric to Electric) (input monitor system) that is a bypass route, there is a possibility of which such a syntax error takes place.
Especially, when an apparatus used in a broadcasting station hangs up due to such ordinary reasons, it is fatal to the broadcasting station. In addition, the apparatus synchronizes with external apparatuses, the situation adversely affects them.
On the other hand, since computers and data recorders treat video data as a simple data sequence, even if video data that does not comply with the standard is input, such a fatal situation does not take place. However, all digital VCRs cannot deal with JPEG and MPEG data streams. In other words, as was described above, the MPEG2 standard is designed to deal with various video formats. Thus, corresponding to the applications, various formats are designated to the digital video apparatus in such a manner that combinations of picture sizes and frame frequencies are limited corresponding to the broadcasting system, that a picture encoding type is fixed to edit video data in the unit of a frame, that a slice structure is limited to allow a picture search as a high speed reproduction, and so forth.
When such a format has been designated to the apparatus, even if a data stream complies with a JPEG or MPEG syntax, when the stream does not comply with the designated format, the apparatus cannot process the stream. Rather, when a data stream that does not comply with the format designated to the apparatus is input thereto, as with the case of the forgoing syntax error, there is a probability of which pictures of the apparatus and other apparatuses connected thereto are disordered, the system loses synchronization, system delay deviates, or the system hangs up.
Thus, when a stream that contains a syntax error or a format violation is output to an apparatus, there is a possibility of which the apparatus faces a serious problem.